## Check that we are able to dump the SHT_MIPS_ABIFLAGS section using -A properly.

## Show how the full output looks like, check the formatting and the output order.
# RUN: yaml2obj %s -DBITS=32 -DENCODE=LSB -o %t.le32
# RUN: llvm-readelf -A %t.le32 | \
# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
# RUN: yaml2obj %s -DBITS=32 -DENCODE=MSB -o %t.be32
# RUN: llvm-readelf -A %t.be32 | \
# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
# RUN: yaml2obj %s -DBITS=64 -DENCODE=LSB -o %t.le64
# RUN: llvm-readelf -A %t.le64 | \
# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
# RUN: yaml2obj %s -DBITS=64 -DENCODE=MSB -o %t.be64
# RUN: llvm-readelf -A %t.be64 | \
# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines

#       GNU:MIPS ABI Flags Version: 101
# GNU-EMPTY:
#  GNU-NEXT:ISA: MIPS32r102
#  GNU-NEXT:GPR size: 32
#  GNU-NEXT:CPR1 size: 64
#  GNU-NEXT:CPR2 size: 128
#  GNU-NEXT:FP ABI: Soft float
#  GNU-NEXT:ISA Extension: Broadcom SB-1
#  GNU-NEXT:ASEs: DSP, DSPR2
#  GNU-NEXT:FLAGS 1: 00000001
#  GNU-NEXT:FLAGS 2: ffffffff

# RUN: llvm-readobj -A %t.le32 | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readobj -A %t.be32 | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readobj -A %t.le64 | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readobj -A %t.be64 | FileCheck %s --check-prefix=LLVM

# LLVM:      MIPS ABI Flags {
# LLVM-NEXT:   Version: 101
# LLVM-NEXT:   ISA: MIPS32r102
# LLVM-NEXT:   ISA Extension: Broadcom SB-1 (0xC)
# LLVM-NEXT:   ASEs [ (0x3)
# LLVM-NEXT:     DSP (0x1)
# LLVM-NEXT:     DSPR2 (0x2)
# LLVM-NEXT:   ]
# LLVM-NEXT:   FP ABI: Soft float (0x3)
# LLVM-NEXT:   GPR size: 32
# LLVM-NEXT:   CPR1 size: 64
# LLVM-NEXT:   CPR2 size: 128
# LLVM-NEXT:   Flags 1 [ (0x1)
# LLVM-NEXT:     ODDSPREG (0x1)
# LLVM-NEXT:   ]
# LLVM-NEXT:   Flags 2: 0xFFFFFFFF
# LLVM-NEXT: }

--- !ELF
FileHeader:
  Class:   ELFCLASS[[BITS=64]]
  Data:    ELFDATA2[[ENCODE=LSB]]
  Type:    ET_REL
  Machine: EM_MIPS
Sections:
## Set arbitrary default values.
  - Name:         .MIPS.abiflags
    Type:         SHT_MIPS_ABIFLAGS
    Version:      [[VERSION=101]]
    ISA:          [[ISA=MIPS32]]
    ISARevision:  [[ISAREV=102]]
    ISAExtension: EXT_SB1
    ASEs:         [ [[ASES=DSP,DSPR2]] ]
    FpABI:        [[FPABI=FP_SOFT]]
    GPRSize:      [[GPR=REG_32]]
    CPR1Size:     [[CPR1=REG_64]]
    CPR2Size:     [[CPR2=REG_128]]
    Flags1:       [ [[FLAG1=ODDSPREG]] ]
    Flags2:       [[FLAG2=0xffffffff]]

## Check that we are able to dump the version properly.
## Document we do not report warnings for any version.
# RUN: yaml2obj %s -DVERSION=0 -o %t.version.a
# RUN: llvm-readelf -A %t.version.a | \
# RUN:   FileCheck %s --check-prefix=GNU-VERSION-A --implicit-check-not=warning:
# RUN: llvm-readobj -A %t.version.a | \
# RUN:   FileCheck %s --check-prefix=LLVM-VERSION-A --implicit-check-not=warning:

# GNU-VERSION-A: MIPS ABI Flags Version: 0

# LLVM-VERSION-A:      MIPS ABI Flags {
# LLVM-VERSION-A-NEXT:   Version: 0

# RUN: yaml2obj %s -DVERSION=0xffff -o %t.version.b
# RUN: llvm-readelf -A %t.version.b | \
# RUN:   FileCheck %s --check-prefix=GNU-VERSION-B --implicit-check-not=warning:
# RUN: llvm-readobj -A %t.version.b | \
# RUN:   FileCheck %s --check-prefix=LLVM-VERSION-B --implicit-check-not=warning:

# GNU-VERSION-B: MIPS ABI Flags Version: 65535

# LLVM-VERSION-B:      MIPS ABI Flags {
# LLVM-VERSION-B-NEXT:   Version: 65535

## Check how we dump isa_level and isa_rev fields.

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS1 -o %t.isa1
# RUN: llvm-readelf -A %t.isa1 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1
# RUN: llvm-readobj -A %t.isa1 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1

# CHECK-ISA: ISA: [[VAL]]{{$}}

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS2 -o %t.isa2
# RUN: llvm-readelf -A %t.isa2 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS2
# RUN: llvm-readobj -A %t.isa2 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS2

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS3 -o %t.isa3
# RUN: llvm-readelf -A %t.isa3 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS3
# RUN: llvm-readobj -A %t.isa3 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS3

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS4 -o %t.isa4
# RUN: llvm-readelf -A %t.isa4 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS4
# RUN: llvm-readobj -A %t.isa4 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS4

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS5 -o %t.isa5
# RUN: llvm-readelf -A %t.isa5 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS5
# RUN: llvm-readobj -A %t.isa5 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS5

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS32 -o %t.isa32
# RUN: llvm-readelf -A %t.isa32 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS32
# RUN: llvm-readobj -A %t.isa32 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS32

# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS64 -o %t.isa64
# RUN: llvm-readelf -A %t.isa64 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS64
# RUN: llvm-readobj -A %t.isa64 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS64

## Check that isa_rev is only dumped when its value > 1.
# RUN: yaml2obj %s -DISAREV=2 -DISA=MIPS1 -o %t.isa1.r
# RUN: llvm-readelf -A %t.isa1.r | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1r2
# RUN: llvm-readobj -A %t.isa1.r | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1r2

## Check how we dump the gpr_size field.

# RUN: yaml2obj %s -DGPR=REG_NONE -o %t.gpr.none
# RUN: llvm-readelf -A %t.gpr.none | FileCheck %s --check-prefix=GPRSIZE -DVAL=0
# RUN: llvm-readobj -A %t.gpr.none | FileCheck %s --check-prefix=GPRSIZE -DVAL=0

# GPRSIZE: GPR size: [[VAL]]{{$}}

# RUN: yaml2obj %s -DGPR=REG_32 -o %t.gpr.32
# RUN: llvm-readelf -A %t.gpr.32 | FileCheck %s --check-prefix=GPRSIZE -DVAL=32
# RUN: llvm-readobj -A %t.gpr.32 | FileCheck %s --check-prefix=GPRSIZE -DVAL=32

# RUN: yaml2obj %s -DGPR=REG_64 -o %t.gpr.64
# RUN: llvm-readelf -A %t.gpr.64 | FileCheck %s --check-prefix=GPRSIZE -DVAL=64
# RUN: llvm-readobj -A %t.gpr.64 | FileCheck %s --check-prefix=GPRSIZE -DVAL=64

# RUN: yaml2obj %s -DGPR=REG_128 -o %t.gpr.128
# RUN: llvm-readelf -A %t.gpr.128 | FileCheck %s --check-prefix=GPRSIZE -DVAL=128
# RUN: llvm-readobj -A %t.gpr.128 | FileCheck %s --check-prefix=GPRSIZE -DVAL=128

## Check how we dump the cpr1_size field.

# RUN: yaml2obj %s -DCPR1=REG_NONE -o %t.cpr1.none
# RUN: llvm-readelf -A %t.cpr1.none | FileCheck %s --check-prefix=CPR1SIZE -DVAL=0
# RUN: llvm-readobj -A %t.cpr1.none | FileCheck %s --check-prefix=CPR1SIZE -DVAL=0

# CPR1SIZE: CPR1 size: [[VAL]]{{$}}

# RUN: yaml2obj %s -DCPR1=REG_32 -o %t.cpr1.32
# RUN: llvm-readelf -A %t.cpr1.32 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=32
# RUN: llvm-readobj -A %t.cpr1.32 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=32

# RUN: yaml2obj %s -DCPR1=REG_64 -o %t.cpr1.64
# RUN: llvm-readelf -A %t.cpr1.64 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=64
# RUN: llvm-readobj -A %t.cpr1.64 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=64

# RUN: yaml2obj %s -DCPR1=REG_128 -o %t.cpr1.128
# RUN: llvm-readelf -A %t.cpr1.128 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=128
# RUN: llvm-readobj -A %t.cpr1.128 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=128

## Check how we dump the cpr2_size field.

# RUN: yaml2obj %s -DCPR2=REG_NONE -o %t.cpr2.none
# RUN: llvm-readelf -A %t.cpr2.none | FileCheck %s --check-prefix=CPR2SIZE -DVAL=0
# RUN: llvm-readobj -A %t.cpr2.none | FileCheck %s --check-prefix=CPR2SIZE -DVAL=0

# CPR2SIZE: CPR2 size: [[VAL]]{{$}}

# RUN: yaml2obj %s -DCPR2=REG_32 -o %t.cpr2.32
# RUN: llvm-readelf -A %t.cpr2.32 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=32
# RUN: llvm-readobj -A %t.cpr2.32 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=32

# RUN: yaml2obj %s -DCPR2=REG_64 -o %t.cpr2.64
# RUN: llvm-readelf -A %t.cpr2.64 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=64
# RUN: llvm-readobj -A %t.cpr2.64 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=64

# RUN: yaml2obj %s -DCPR2=REG_128 -o %t.cpr2.128
# RUN: llvm-readelf -A %t.cpr2.128 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=128
# RUN: llvm-readobj -A %t.cpr2.128 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=128

## Check how we dump the fp_abi field.

# RUN: yaml2obj %s -DFPABI=FP_ANY -o %t.fpabi.any
# RUN: llvm-readelf -A %t.fpabi.any | FileCheck %s --check-prefix=FPABI-ANY
# RUN: llvm-readobj -A %t.fpabi.any | FileCheck %s --check-prefix=FPABI-ANY

# FPABI-ANY: FP ABI: Hard or soft float

# RUN: yaml2obj %s -DFPABI=FP_DOUBLE -o %t.fpabi.double
# RUN: llvm-readelf -A %t.fpabi.double | FileCheck %s --check-prefix=FPABI-DOUBLE
# RUN: llvm-readobj -A %t.fpabi.double | FileCheck %s --check-prefix=FPABI-DOUBLE

# FPABI-DOUBLE: FP ABI: Hard float (double precision)

# RUN: yaml2obj %s -DFPABI=FP_SINGLE -o %t.fpabi.single
# RUN: llvm-readelf -A %t.fpabi.single | FileCheck %s --check-prefix=FPABI-SINGLE
# RUN: llvm-readobj -A %t.fpabi.single | FileCheck %s --check-prefix=FPABI-SINGLE

# FPABI-SINGLE: FP ABI: Hard float (single precision)

# RUN: yaml2obj %s -DFPABI=FP_SOFT -o %t.fpabi.soft
# RUN: llvm-readelf -A %t.fpabi.soft | FileCheck %s --check-prefix=FPABI-SOFT
# RUN: llvm-readobj -A %t.fpabi.soft | FileCheck %s --check-prefix=FPABI-SOFT

# FPABI-SOFT: FP ABI: Soft float

# RUN: yaml2obj %s -DFPABI=FP_OLD_64 -o %t.fpabi.old64
# RUN: llvm-readelf -A %t.fpabi.old64 | FileCheck %s --check-prefix=FPABI-OLD64
# RUN: llvm-readobj -A %t.fpabi.old64 | FileCheck %s --check-prefix=FPABI-OLD64

# FPABI-OLD64: FP ABI: Hard float (MIPS32r2 64-bit FPU 12 callee-saved)

# RUN: yaml2obj %s -DFPABI=FP_XX -o %t.fpabi.xx
# RUN: llvm-readelf -A %t.fpabi.xx | FileCheck %s --check-prefix=FPABI-XX
# RUN: llvm-readobj -A %t.fpabi.xx | FileCheck %s --check-prefix=FPABI-XX

# FPABI-XX: FP ABI: Hard float (32-bit CPU, Any FPU)

# RUN: yaml2obj %s -DFPABI=FP_64 -o %t.fpabi.fp64
# RUN: llvm-readelf -A %t.fpabi.fp64 | FileCheck %s --check-prefix=FPABI-FP64
# RUN: llvm-readobj -A %t.fpabi.fp64 | FileCheck %s --check-prefix=FPABI-FP64

# FPABI-FP64: FP ABI: Hard float (32-bit CPU, 64-bit FPU)

# RUN: yaml2obj %s -DFPABI=FP_64A -o %t.fpabi.fp64a
# RUN: llvm-readelf -A %t.fpabi.fp64a | FileCheck %s --check-prefix=FPABI-FP64A
# RUN: llvm-readobj -A %t.fpabi.fp64a | FileCheck %s --check-prefix=FPABI-FP64A

# FPABI-FP64A: FP ABI: Hard float compat (32-bit CPU, 64-bit FPU)

## Check how we dump ASEs.
# RUN: yaml2obj %s -DASES="" -o %t.ases.no
# RUN: llvm-readelf -A %t.ases.no | FileCheck %s --check-prefix=FPABI-ASES-NONE-GNU
# RUN: llvm-readobj -A %t.ases.no | FileCheck %s --check-prefix=FPABI-ASES-NONE-LLVM

# FPABI-ASES-NONE-GNU: ASEs: None

# FPABI-ASES-NONE-LLVM:      ASEs [ (0x0)
# FPABI-ASES-NONE-LLVM-NEXT: ]

# RUN: yaml2obj %s -DASES="DSP,DSPR2,EVA,MCU,MDMX,MIPS3D,MT,SMARTMIPS,VIRT,MSA,MIPS16,MICROMIPS,XPA,CRC,GINV" -o %t.ases.all
# RUN: llvm-readelf -A %t.ases.all | FileCheck %s --check-prefix=FPABI-ASES-ALL-GNU
# RUN: llvm-readobj -A %t.ases.all | FileCheck %s --check-prefix=FPABI-ASES-ALL-LLVM

# FPABI-ASES-ALL-GNU: ASEs: DSP, DSPR2, Enhanced VA Scheme, MCU, MDMX, MIPS-3D, MT, SmartMIPS, VZ, MSA, MIPS16, microMIPS, XPA, CRC, GINV

# FPABI-ASES-ALL-LLVM:      ASEs [ (0x29FFF)
# FPABI-ASES-ALL-LLVM-NEXT:   CRC (0x8000)
# FPABI-ASES-ALL-LLVM-NEXT:   DSP (0x1)
# FPABI-ASES-ALL-LLVM-NEXT:   DSPR2 (0x2)
# FPABI-ASES-ALL-LLVM-NEXT:   Enhanced VA Scheme (0x4)
# FPABI-ASES-ALL-LLVM-NEXT:   GINV (0x20000)
# FPABI-ASES-ALL-LLVM-NEXT:   MCU (0x8)
# FPABI-ASES-ALL-LLVM-NEXT:   MDMX (0x10)
# FPABI-ASES-ALL-LLVM-NEXT:   MIPS-3D (0x20)
# FPABI-ASES-ALL-LLVM-NEXT:   MIPS16 (0x400)
# FPABI-ASES-ALL-LLVM-NEXT:   MSA (0x200)
# FPABI-ASES-ALL-LLVM-NEXT:   MT (0x40)
# FPABI-ASES-ALL-LLVM-NEXT:   SmartMIPS (0x80)
# FPABI-ASES-ALL-LLVM-NEXT:   VZ (0x100)
# FPABI-ASES-ALL-LLVM-NEXT:   XPA (0x1000)
# FPABI-ASES-ALL-LLVM-NEXT:   microMIPS (0x800)
# FPABI-ASES-ALL-LLVM-NEXT: ]

## Check how we dump the flags1 field.

# RUN: yaml2obj %s -DFLAG1="" -o %t.flag1.empty
# RUN: llvm-readelf -A %t.flag1.empty | FileCheck %s --check-prefix=FLAG1-EMPTY-GNU
# RUN: llvm-readobj -A %t.flag1.empty | FileCheck %s --check-prefix=FLAG1-EMPTY-LLVM

# FLAG1-EMPTY-GNU: FLAGS 1: 00000000

# FLAG1-EMPTY-LLVM:      Flags 1 [ (0x0)
# FLAG1-EMPTY-LLVM-NEXT: ]

# RUN: yaml2obj %s -DFLAG1="ODDSPREG" -o %t.flag1.all
# RUN: llvm-readelf -A %t.flag1.all | FileCheck %s --check-prefix=FLAG1-ALL-GNU
# RUN: llvm-readobj -A %t.flag1.all | FileCheck %s --check-prefix=FLAG1-ALL-LLVM

# FLAG1-ALL-GNU: FLAGS 1: 00000001

# FLAG1-ALL-LLVM:      Flags 1 [ (0x1)
# FLAG1-ALL-LLVM-NEXT:  ODDSPREG (0x1)
# FLAG1-ALL-LLVM-NEXT: ]

## Check how we dump the flags2 field.

# RUN: yaml2obj %s -DFLAG2=0x0 -o %t.flag2.empty
# RUN: llvm-readelf -A %t.flag2.empty | FileCheck %s --check-prefix=FLAG2-EMPTY-GNU
# RUN: llvm-readobj -A %t.flag2.empty | FileCheck %s --check-prefix=FLAG2-EMPTY-LLVM

# FLAG2-EMPTY-GNU:  FLAGS 2: 00000000
# FLAG2-EMPTY-LLVM: Flags 2: 0x0

# RUN: yaml2obj %s -DFLAG2=0xffffffff -o %t.flag2.all
# RUN: llvm-readelf -A %t.flag2.all | FileCheck %s --check-prefix=FLAG2-ALL-GNU
# RUN: llvm-readobj -A %t.flag2.all | FileCheck %s --check-prefix=FLAG2-ALL-LLVM

# FLAG2-ALL-GNU:  FLAGS 2: ffffffff
# FLAG2-ALL-LLVM: Flags 2: 0xFFFFFFF

## Check what we print when there is no .MIPS.abiflags section in the file.
# RUN: yaml2obj --docnum=2 %s -o %t.nosection
## Note: GNU readelf 2.31.1 prints nothing.
# RUN: llvm-readelf -A %t.nosection 2>&1 | \
# RUN:   FileCheck %s --check-prefix=NOSEC --implicit-check-not={{.}}
# RUN: llvm-readobj -A %t.nosection 2>&1 | \
# RUN:   FileCheck %s --check-prefixes=NOSEC,NOSEC-LLVM --implicit-check-not=warning:

# NOSEC-LLVM: There is no .MIPS.abiflags section in the file.
# NOSEC:      There is no .MIPS.options section in the file.
# NOSEC-NEXT: There is no .reginfo section in the file.

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_MIPS
Sections: []

## Check we report a warning when we are unable to read the content of the .MIPS.abiflags section.
# RUN: yaml2obj --docnum=3 -DSHOFFSET=0xffffffff %s -o %t.err1
# RUN: llvm-readelf -A %t.err1 2>&1 | FileCheck %s -DFILE=%t.err1 --check-prefix=CONTENT-ERR
# RUN: llvm-readobj -A %t.err1 2>&1 | FileCheck %s -DFILE=%t.err1 --check-prefix=CONTENT-ERR

# CONTENT-ERR:      warning: '[[FILE]]': unable to read the .MIPS.abiflags section: section [index 2] has a sh_offset (0xffffffff) + sh_size (0x18) that is greater than the file size (0x2c0)
# CONTENT-ERR-NEXT: There is no .MIPS.options section in the file.
# CONTENT-ERR-NEXT: There is no .reginfo section in the file.

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_MIPS
Sections:
  - Type:   SHT_PROGBITS
    ShName: [[NAME=<none>]]
  - Name:     .MIPS.abiflags
    Type:     SHT_MIPS_ABIFLAGS
    ISA:      MIPS32
    Offset:   0x100
    ShOffset: [[SHOFFSET=0x100]]
    ShSize:   [[SHSIZE=24]]
    ShName: [[ABIFLAGSNAME=<none>]]
  - Type:   SHT_PROGBITS
    ShName: [[NAME=<none>]]

## Check we report a warning when the .MIPS.abiflags section has an unexpected size.
# RUN: yaml2obj --docnum=3 -DSHSIZE=23 %s -o %t.err2
# RUN: llvm-readelf -A %t.err2 2>&1 | FileCheck %s -DFILE=%t.err2 --check-prefix=SIZE-ERR
# RUN: llvm-readobj -A %t.err2 2>&1 | FileCheck %s -DFILE=%t.err2 --check-prefix=SIZE-ERR

# SIZE-ERR:      warning: '[[FILE]]': unable to read the .MIPS.abiflags section: it has a wrong size (23)
# SIZE-ERR-NEXT: There is no .MIPS.options section in the file.
# SIZE-ERR-NEXT: There is no .reginfo section in the file.

## Check that we try to dump the .MIPS.abiflags section when we are able to locate it by name.
# RUN: yaml2obj --docnum=3 -DNAME=0xffff %s -o %t.err3
# RUN: llvm-readelf -A %t.err3 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.err3 --check-prefixes=NAME-ERR-FOUND,NAME-ERR-FOUND-GNU --implicit-check-not=warning:
# RUN: llvm-readobj -A %t.err3 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.err3 --check-prefixes=NAME-ERR-FOUND,NAME-ERR-FOUND-LLVM --implicit-check-not=warning:

# NAME-ERR-FOUND:           warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 1: a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
# NAME-ERR-FOUND-GNU-NEXT:  MIPS ABI Flags Version: 0
# NAME-ERR-FOUND-LLVM-NEXT: MIPS ABI Flags {
# NAME-ERR-FOUND:           warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 3: a section [index 3] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table

## Check we report a warning when we are unable to find the .MIPS.abiflags section due to an error.
# RUN: yaml2obj --docnum=3 -DABIFLAGSNAME=0xffff %s -o %t.err4
# RUN: llvm-readelf -A %t.err4 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.err4 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning: --implicit-check-not="MIPS ABI Flags"
# RUN: llvm-readobj -A %t.err4 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t.err4 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning: --implicit-check-not="MIPS ABI Flags"

# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_MIPS_ABIFLAGS section with index 2: a section [index 2] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
